<?
require("config.php");

$menutype = 1;

//$addon='<input type="hidden" name="cat" value="'.$cat.'">';

require($rela_path . "inc/header.php");
?>
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">&nbsp; </td>
  </tr>
  <tr> 
    <td>

<? require($rela_path . "inc/addrecord.php") ?>


<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">
		<form action="" method="get" name="catform" id="catform">
	  Select Category <?

$tb = "pro_category";

$Query = "select name,id,cname from $tb WHERE level=0 order by id";
$r = myQuery($Query);


$Query = "select name, parent,id,cname from $tb WHERE level=1 order by id";
$r1 = myQuery($Query);

$Query = "select name, parent,id,cname from $tb WHERE level=2 order by id";
$r2 = myQuery($Query);

$sourceData = array();
$sourceLabel = array();

for ($i=0;$i<count($r);$i++){

	array_push($sourceData,$r[$i][1]);
	array_push($sourceLabel,$r[$i][0].' '.$r[$i][2]);

	for ($n=0;$n<count($r1);$n++){

		if ($r[$i][1]==$r1[$n][1]){

			array_push($sourceData,$r1[$n][2]);
			array_push($sourceLabel,"-&nbsp;&nbsp;&nbsp;" . $r1[$n][0].' '.$r1[$n][3] );

			for ($m=0;$m<count($r2);$m++){

			if ($r1[$n][2]==$r2[$m][1]){

				array_push($sourceData,$r2[$m][2]);
				array_push($sourceLabel,"---&nbsp;&nbsp;&nbsp;" . $r2[$m][0].' '.$r2[$m][3] );

			}
			}

		}
	}
}

FFPSelectBox('cat',$cat,$sourceData,$sourceLabel);
$Url="&Searcn=$Search&action=$action";
if ($catstr) $Url.="&cat=$cat";

?>
      <input type="submit" name="Submit" value="Submit">
	  &nbsp;&nbsp; <a href="../../report/export_pro.php?s=<?=$Url?>"><img src="../../images/excel.gif" border="0" align="absmiddle"></a>
        </form>	<br></td>
    </tr>
  <tr>
    <td valign="top"><br>
       <? require($rela_path . "inc/pro_list.php")?></td>
  </tr>
</table>

</td>
  </tr>
</table>
<?
require($rela_path . "inc/footer.php");
?>
